package com.qf.controller;

import com.qf.entity.TbInfoDetail;
import com.qf.service.TbInfoDetailService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TbInfoDetail)表控制层
 *
 * @author makejava
 * @since 2021-04-06 09:44:32
 */
@RestController
@RequestMapping("tbInfoDetail")
public class TbInfoDetailController {
    /**
     * 服务对象
     */
    @Resource
    private TbInfoDetailService tbInfoDetailService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public TbInfoDetail selectOne(Integer id) {
        return this.tbInfoDetailService.queryById(id);
    }

    @PostMapping("selectDetailName")
    public List<String> selectDetailName(@RequestBody String arr){
        String[] arrs = arr.split(",");
        int[] detailIds = new int[arrs.length - 1];
        for (int i = 0; i < arrs.length - 1; i++) {
            detailIds[i] = Integer.parseInt(arrs[i]);
        }
//        System.out.println(detailIds);
        return tbInfoDetailService.queryDetailName(detailIds);
    }

}